home *** CD-ROM | disk | FTP | other *** search
/ El Mac 9 / El Mac 9.iso / Shareware / Applications / MathPad 2.4 / XFuns / fft / fft.rsrc / TEXT_128_fft().txt next >
Encoding:
Text File  |  1996-03-06  |  791 b   |  25 lines

  1. ------------ fft(C)
  2. ~
  3. returns the discrete Fourier transform of array C in the global array "transform".
  4.  
  5. C is an array of n samples (n must be a power of 2) of a complex function y(t). For sample period dt, "transform" will contain the positive and negative complex frequency components arranged as
  6.  
  7. transform[1]     f=0      [1,1] real. [1,2] imaginary.
  8. transform[2]     f=1/(n*dt)
  9. ...
  10. transform[n/2+1] f=1/(2*dt) also f=-1/(2*dt)
  11. transform[n/2+2] f=-(n/2-1)/(n*dt)
  12. ...
  13. transform[n]     f=-1/(n*dt)
  14. ~
  15.  
  16. y(t) = cos(360*f*t+phi)     -- example function ** uses degrees **
  17. c(t) = {y(t),0}             -- make it a complex function
  18. C[i] = c(dt*(i-1)) dim[n]   -- sample it at period dt
  19.  
  20. n=8;     f=3;     phi=30;      dt=1/n
  21.  
  22. fft(C):
  23. Nmax=n; Nsteps=n
  24. table  N,   transform[N,1], transform[N,2]
  25.